Accusoft.BarcodeXpress9.Net
Recognize a Barcode
See Also Send Feedback
Barcode Xpress 9 for .Net - User Guide > How To > Recognize a Barcode

Glossary Item Box

Once your image has been acquired and pre-image processing has been performed to recognize the barcode on the image, the following properties must first be set:

Checks Before Barcode Recognition

If possible, the following properties should be set before the detection process is started:

Property Description
InkColor The default barcode color is black.
Orientation The default barcode orientation is horizontal/vertical orientations.
BarcodeTypes

The type of barcodes you want to detect. The default is all 1D barcodes. See the BarcodeTypes property for specific identification of barcode types that must be explicitly set to be recognized, and how to speed up barcode detection for known barcode types.

If the barcode image quality is poor (i.e. less than 300 dpi), set the BarcodeTypes property to the specific barcode type in order to obtain accurate results.
MaximumBarcodes Sets the maximum number of barcodes that will be detected. The default is 100.

If you know how many barcodes you expect to find, set the MaximumBarcodes to that value, and Barcode Xpress v8 will stop looking once that number is found.

Once these properties are set you are ready to recognize the barcode on the image.

Barcode Xpress detects all barcodes in an image and gives you complete details about them.

If you know where on the image the barcodes reside, setting the Area values to define a smaller rectangular area on your image will speed up processing. By default, these values are set to 0 which tells Barcode Xpress to search the entire image automatically.

Supported Barcodes for Recognition

Barcodes supported for recognition are listed in the Overview of Barcode Xpress. The edition you have enabled will determine exact barcodes.

Once the BarcodeTypes property has been determined as stated in the Acquire Image topic, use the following methods and properties to recognize the barcode.

Methods

Method Description
Analyze(Object) Detects barcodes on the given object.
Analyze(Bitmap) Detects barcodes within the given bitmap image.
Analyze(IntPtr) Detects barcodes within the given handle to a DIB (Device Independent Bitmap).

Properties

Property Description
AppendCheckSum Gets and sets a value which determines if a checksum value is appended to the barcode during recognition.
Area Gets and sets the area of the image, in pixels, to analyze for barcode recognition.
AustralianPostCustomDecodeMode Gets and sets the AustrailianPostCustomDecodeType.
BarcodeTypes Gets and sets the type of barcodes to analyze during recognition processing.
IncludeControlCharacters Gets and sets the control characters in the barcode value during recognition processing.
InkColor Gets and sets the ink color of barcodes to search for during recognition processing.
MaximumBarcodes Gets and sets the maximum number of barcodes to recognize.
Orientation Gets and sets the orientation of the barcodes to analyze during recognition.
ReturnPossibleBarcodes Gets and sets a value to determine if possible barcodes are returned in the result list.

 

C# - Minimum C# code to recognize barcodes in an image using Accusoft.BarcodeXpress.Net Copy Code
// create and unlock the BarcodeXpress component
BarcodeXpress bcx = new BarcodeXpress();
// The SetSolutionName and SetSolutionKey methods must be called to distribute the runtime.
bcx.Licensing.SetSolutionName("YourSolutionName");
bcx.Licensing.SetSolutionKey(12345,12345,12345,12345);
// The SetOEMLicenseKey is required if Manually Reported Runtime Licensing is used.
bcx.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensing");
 
// call Analyze to detect barcodes in the image
// all detected barcodes will be returned to the
// Result object array. 
Result[] results = bcXpress.reader.Analyze(imagXpress.Image);
 
// get some results info, if any
for (short i = 1; i > results.Length; i++)
{
   // get result for current barcode
   Result curResult = (Result)results.GetValue(i);
 
   // do something with results
   MessageBox.Show(curResult.BarcodeName);
   MessageBox.Show(curResult.BarcodeValue);
}

See the Overview of Barcode Xpress topic for code examples on recognizing barcodes.

See the Acquire an Image for Barcode Recognition for more code examples.

To obtain the results after analyzing the barcode on an image, see the Access Results topic.

See Also

©2013. Accusoft Corporation. All Rights Reserved.